package com.amphora.util.factories;

import java.util.Calendar;
import java.util.HashMap;

import com.amphora.model.Booking;
import com.amphora.model.CalendarEvent;
import com.amphora.model.Category;
import com.amphora.model.SystemProperty;
import com.amphora.model.Treatment;
import com.amphora.model.TreatmentType;
import com.amphora.model.User;

public class DomainFactory {

	public static User getUser(HashMap<String,String> userDetails){
		User user = new User();
		user.setUsername(userDetails.get("username"));
		user.setName(userDetails.get("name"));
		user.setSurname(userDetails.get("surname"));
		user.setEmailAddress(userDetails.get("email"));
		user.setContactNumber(userDetails.get("contact"));
		user.setPassword(userDetails.get("password"));
		user.setRole(userDetails.get("role"));
		
		return user;
	}
	
	public static Category getCategory(String name,String description){
		Category category = new Category();
		category.setName(name);
		category.setDescription(description);
		
		return category;
	}
	
	public static TreatmentType getTreatmentType(HashMap<String,String> ttValues,int price,Long duration){
		TreatmentType treatmentType = new TreatmentType();
		treatmentType.setName(ttValues.get("name"));
		treatmentType.setDescription(ttValues.get("description"));
		treatmentType.setPrice(price);
		treatmentType.setTreatmentDuration(duration);
		return treatmentType;
	}
	
	public static Treatment getTreatment(int duration,int totalDone){
		Treatment treatment = new Treatment();
		treatment.setDuration(duration);
		treatment.setTotalDone(totalDone);
		
		return treatment;
	}
	
	public static Booking getBooking(String approved, Calendar appointmentDate){
		Booking booking = new Booking();
		booking.setApproved(approved);
		booking.setAppointmentDate(appointmentDate);
		
		return booking;
	}
	
	public static CalendarEvent getCalendarEvent(HashMap<String,Calendar> dates, String title){
		CalendarEvent ce = new CalendarEvent();
		ce.setStart(dates.get("startTime"));
		ce.setEnd(dates.get("endTime"));
		ce.setTitle(title);
		
		return ce;
	}
	
	public static SystemProperty getSystemProperty(String name,String value){
		SystemProperty s = new SystemProperty();
		s.setName(name);
		s.setValue(value);
		
		return s;
	}
}
